<template>
  <div id="alldetails">  
    


     <el-form ref="form"  label-width="0px">  
            <el-row>
                <el-col :span="20" style="display:flex;">
                    <div style="height:38px;line-height:38px;"> 
                        <i class="el-icon-back" @click="goBack"></i> 
                        {{ $route.query.name }} 
                        </div>
                    <el-form-item label="" style="margin-left:5px;">
                        <el-select  v-model="form.select_num" placeholder="请选择状态" style="width:150px;" @change="select_change()">
                            <el-option  v-for="(item,index) in select_data" :key="index" :label="item.name" :value="item.id" ></el-option>
                        </el-select>
                    </el-form-item>
                </el-col> 
                <el-col :span="4" style="text-align: right;">
                <el-button class="custom_color_button" type="primary" @click="refresh_but()">刷新</el-button>
                </el-col>  
        </el-row>

  </el-form >

   <!-- 渲染数据list -->
   <all-details-list :datalist="datalist" @up_list_fun="list_fun"> </all-details-list>

      
   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>

      
  </div>
</template>

<script>
import AllDetailsList from '@/view/Search/AllDetailsList'
export default {
  name: 'alldetails',
  data () {
    return {
        datalist:[],
        page:1,
        count:0,
        my_id:'',
        form:{
            select_num:''
        },
        select_data:[{"name":"恢复持有","id":"RECOVERY_GOODS"},{"name":"兑换果米","id":"EXCHANGE_KMB"}
        ,{"name":"进行收货","id":"DELIVERY_GOODS"},{"name":"拆分土地","id":"FINISH_SPLIT_ADMIN"}
        ,{"name":"拆分土地和果米","id":"FINISH_SPLIT_AND_KMB_ADMIN"}]
    }
  },
 components:{
    AllDetailsList
  },
  created(){
     this.my_id = this.$route.query.id
     this.list_fun()
  },
  mounted (){
    
  },
  methods: {
      list_fun(){
          this.post("/Statistics/handleList", {
              page:this.page,
              uid:this.my_id,
              type:this.form.select_num
	        }).then(res => {
              this.count = res.result.count
              this.datalist = res.result.list
              //console.log(res,"yyyy")
         })
      },
      select_change(){
           this.page =  1
           this.list_fun()

      },
       refresh_but(){
        this.page = 1
        this.form.select_num = ''
        this.list_fun()
      },
     goBack() {
        this.$router.go(-1)
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>
</style>
